package com.lucanjun.cn.springboot.multipledatasources.business.controller;

import com.lucanjun.cn.springboot.multipledatasources.business.model.dto.base.RSADto;
import com.lucanjun.cn.springboot.multipledatasources.common.annotation.RSA.RSA;
import com.lucanjun.cn.springboot.multipledatasources.common.result.HttpResult;
import com.lucanjun.cn.springboot.multipledatasources.common.utils.AES256Util;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

/**
 * @author lucanjun
 * @version 1.0.0
 * @title TestController
 * @create 2024-12-19 16:55:19
 * @description 测试类
 */
@Slf4j
@RestController
@Tag(name = "测试模块")
@RequiredArgsConstructor
@RequestMapping("/api/test")
public class TestController {

    @PostMapping("/hello")
    @Operation(summary = "hello", description = "hello")
    public HttpResult<Object> hello() {
        return HttpResult.returnSuccess();
    }

    @GetMapping("/CFB")
    @Operation(summary = "CFB", description = "CFB")
    public HttpResult<Object> hello(@Param("text") String text) {
        String encryptTextCFB = AES256Util.encryptCFB(text);
        return HttpResult.returnSuccess(encryptTextCFB);
    }

    @RSA
    @PostMapping("/rsa")
    @Operation(summary = "rsa", description = "rsa")
    public HttpResult<Object> rsa(@RequestBody @Valid RSADto rsaDto) {
        return HttpResult.returnSuccess();
    }

}
